package com.atguigu.mybatisplus.service.impl;

import com.atguigu.mybatisplus.mapper.UserMapper;
import com.atguigu.mybatisplus.pojo.User;
import com.atguigu.mybatisplus.service.UserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Autowired
    UserMapper userMapper;

    /**
     * 根据名称查询用户对象
     * @param name
     * @return List<User>
     */
    @Override
    public List<User> selectByName(String name) {
        Map<String,Object> map = new HashMap<>();
        map.put("name",name);
        List<User> users = userMapper.selectByMap(map);
        return users;
    }
}
